package com.demo.service.impl;

import com.demo.entity.LogDTO;
import com.demo.repository.mapper.DemoMapper;
import com.demo.service.DemoService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class DemoServiceImpl implements DemoService {
//    private static final Logger logger = LoggerFactory.getLogger(LogServiceImpl.class);

    @Autowired
    private DemoMapper demoMapper;

    @Transactional
    public void insertLog(LogDTO logDTO){
        demoMapper.insert(logDTO);
    }

    public List getLog(){
        List list = demoMapper.getLog();
       return list;
    }
    public List getList(int pageNum,int pageSize){
        //使用分页插件，核心代码就一行
        PageHelper.startPage(pageNum,pageSize);
        List list = demoMapper.getList();
        return list;
    }
}
